
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>FAQ · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../ch03/ipv4-router.html" />
    
    
    <link rel="prev" href="ltv.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Computer Network Lab Manual
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../ch01/lab-1.html">
            
                <a href="../ch01/lab-1.html">
            
                    
                    Lab 1: Switchyard & Mininet
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../ch01/prerequisites.html">
            
                <a href="../ch01/prerequisites.html">
            
                    
                    Task 1: Prerequisites
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../ch01/linux.html">
            
                <a href="../ch01/linux.html">
            
                    
                    Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../ch01/python.html">
            
                <a href="../ch01/python.html">
            
                    
                    Python
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../ch01/git.html">
            
                <a href="../ch01/git.html">
            
                    
                    Git
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../ch01/workflow.html">
            
                <a href="../ch01/workflow.html">
            
                    
                    Task 2: Workflow
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../ch01/vscode.html">
            
                <a href="../ch01/vscode.html">
            
                    
                    VS Code
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../ch01/mininet.html">
            
                <a href="../ch01/mininet.html">
            
                    
                    Mininet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="../ch01/wireshark.html">
            
                <a href="../ch01/wireshark.html">
            
                    
                    Wireshark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.4" data-path="../ch01/switchyard.html">
            
                <a href="../ch01/switchyard.html">
            
                    
                    Switchyard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../ch01/nju-gitlab.html">
            
                <a href="../ch01/nju-gitlab.html">
            
                    
                    Task 3: NJU GitLab
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../ch01/modification.html">
            
                <a href="../ch01/modification.html">
            
                    
                    Task 4: Modification
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="lab-2.html">
            
                <a href="lab-2.html">
            
                    
                    Lab 2: Learning Switch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="preparation.html">
            
                <a href="preparation.html">
            
                    
                    Task 1: Preparation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="basic-switch.html">
            
                <a href="basic-switch.html">
            
                    
                    Task 2: Basic Switch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="timeouts.html">
            
                <a href="timeouts.html">
            
                    
                    Task 3: Timeouts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="lru.html">
            
                <a href="lru.html">
            
                    
                    Task 4: Least Recently Used
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="ltv.html">
            
                <a href="ltv.html">
            
                    
                    Task 5: Least Traffic Volume
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.6" data-path="faq.html">
            
                <a href="faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../ch03/ipv4-router.html">
            
                <a href="../ch03/ipv4-router.html">
            
                    
                    Lab 3-5: IPv4 Router
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../ch03/subch01/lab-3.html">
            
                <a href="../ch03/subch01/lab-3.html">
            
                    
                    Lab 3: Respond to ARP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../ch03/subch01/preparation.html">
            
                <a href="../ch03/subch01/preparation.html">
            
                    
                    Task 1: Preparation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../ch03/subch01/handle-arp-request.html">
            
                <a href="../ch03/subch01/handle-arp-request.html">
            
                    
                    Task 2: Handle ARP Request
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.3" data-path="../ch03/subch01/arp-table.html">
            
                <a href="../ch03/subch01/arp-table.html">
            
                    
                    Task 3: Cached ARP Table
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../ch03/faq.html">
            
                <a href="../ch03/faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../appendix/appendix.html">
            
                <a href="../../appendix/appendix.html">
            
                    
                    Appendix
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../appendix/environment-setup.html">
            
                <a href="../../appendix/environment-setup.html">
            
                    
                    Environment Setup
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../appendix/about-this-repository.html">
            
                <a href="../../appendix/about-this-repository.html">
            
                    
                    About This Repository
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >FAQ</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="faq"><a name="faq" class="plugin-anchor" href="#faq"><i class="fa fa-link" aria-hidden="true"></i></a>FAQ</h1>
<ol>
<li><p><strong>Q:</strong> Let&apos;s assume that the table in my switch has 5 entries: <code>[h2, h3, h4, h5, h1]</code> where <code>h2</code> is the entry that has not been matched the longest while <code>h1</code> is the most recently matched entry. If a new packet <code>(src=h6, dest=h2)</code> arrives, how is my switch supposed to handle this packet in the LRU-based entry removal implementation (assuming that the network topology does not change)?</p>
<p><strong>A:</strong> Whenever you receive a new packet, you will assess the state of the switch as if you don&apos;t know about the new packet and make decisions accordingly. So when your switch receives <code>(h6, h2)</code>, it is going to add an entry for <code>h6</code> since it is not in the table. However, since the table is full (5 entries) it will need to remove the LRU entry, which is <code>h2</code>. So your table is going to look like this: <code>[h3, h4, h5, h1, h6]</code> and your switch will broadcast the incoming packets on all ports except for the incoming port since it does not have information about <code>h2</code> anymore. In other words, your switch (upon receiving the packet) is not going to update the table to <code>[h3, h4, h5, h1, h2]</code>, remove <code>h3</code> and add <code>h6</code> to get <code>[h4, h5, h1, h6, h2]</code> and output the packet on a single port, which goes to <code>h2</code>.</p>
</li>
<li><p><strong>Q:</strong> How do the entry removal mechanisms work?</p>
<p><strong>A:</strong> Note that the flow chart for timeout based mechanism does not show when/how to purge the stale entries. Your implementation will obviously handle this as well. Keep in mind that there is not a limit on the number of entries that the table can hold for this mechanism.</p>
</li>
<li><p><strong>Q:</strong> How would the table look for the following sequence of packets in the LRU-based implementation: <code>(h1,h4)</code>, <code>(h2,h1)</code>, <code>(h3,h1)</code>, <code>(h4,h1)</code>, <code>(h5,h1)</code>, <code>(h6.h7)</code>, <code>(h4,h5)</code>? (assuming that the network topology does not change)</p>
<p><strong>A:</strong> Assuming that the leftmost entry is the most recently used and the rightmost is the least recently used: <code>[h1] &#x2192; [h1, h2] &#x2192; [h1, h3, h2] &#x2192; [h1, h4, h3, h2] &#x2192; [h1, h5, h4, h3, h2] &#x2192; [h6, h1, h5, h4, h3] &#x2192; [h5, h6, h1, h4, h3]</code></p>
</li>
<li><p><strong>Q:</strong> Should our switch implementations be aware of changes in the topology?</p>
<p><strong>A:</strong> Your learning switch has to be aware of the changes in the topology. More specifically, if the switch receives a packet from host A on its interface 1 (<code>i1</code>) it will record this in its table <code>{a &#x2192; i1}</code>. Later, if the switch receives another packet from host A but on a different interface (say <code>i2</code>), and if the entry <code>{a &#x2192; i1}</code> is still present, it will be updated to <code>{a &#x2192; i2}</code>. There will not be two different entries for the same host in your table! Reflecting the topological changes in your implementations will differ slightly:</p>
<ul>
<li><p>Timeout-based: When updating the entry for a particular host, reset its timer to 0 (this will be equivalent to refreshing the entry for that host).</p>
</li>
<li><p>LRU-based: When updating the entry for a particular host, <em>do not</em> update its LRU information.</p>
</li>
<li><p>Traffic volume-based: When updating the entry for a particular host, keep the same traffic volume count for the host. <em>Do not</em> set it to 0.</p>
</li>
</ul>
</li>
<li><p><strong>Q:</strong> In traffic volume based entry removal, which entry should be removed if there are two entries with the lowest traffic volume?</p>
<p><strong>A:</strong> You can pick an entry randomly.</p>
</li>
</ol>

<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="ltv.html" class="navigation navigation-prev " aria-label="Previous page: Task 5: Least Traffic Volume">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../ch03/ipv4-router.html" class="navigation navigation-next " aria-label="Next page: Lab 3-5: IPv4 Router">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"FAQ","level":"1.3.6","depth":2,"next":{"title":"Lab 3-5: IPv4 Router","level":"1.4","depth":1,"path":"content/ch03/ipv4-router.md","ref":"content/ch03/ipv4-router.md","articles":[{"title":"Lab 3: Respond to ARP","level":"1.4.1","depth":2,"path":"content/ch03/subch01/lab-3.md","ref":"content/ch03/subch01/lab-3.md","articles":[{"title":"Task 1: Preparation","level":"1.4.1.1","depth":3,"path":"content/ch03/subch01/preparation.md","ref":"content/ch03/subch01/preparation.md","articles":[]},{"title":"Task 2: Handle ARP Request","level":"1.4.1.2","depth":3,"path":"content/ch03/subch01/handle-arp-request.md","ref":"content/ch03/subch01/handle-arp-request.md","articles":[]},{"title":"Task 3: Cached ARP Table","level":"1.4.1.3","depth":3,"path":"content/ch03/subch01/arp-table.md","ref":"content/ch03/subch01/arp-table.md","articles":[]}]},{"title":"FAQ","level":"1.4.2","depth":2,"path":"content/ch03/faq.md","ref":"content/ch03/faq.md","articles":[]}]},"previous":{"title":"Task 5: Least Traffic Volume","level":"1.3.5","depth":2,"path":"content/ch02/ltv.md","ref":"content/ch02/ltv.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["theme-comscore","back-to-top-button","-lunr","-search","search-pro","github","splitter","flexible-alerts","page-toc-button","auto-scroll-table","popup","anchors"],"pluginsConfig":{"styles":{"website":"styles/website.css"},"github":{"url":"https://github.com/shellqiqi/nju-network-experiments"},"splitter":{},"search-pro":{},"auto-scroll-table":{},"popup":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"page-toc-button":{},"back-to-top-button":{},"flexible-alerts":{"danger":{"className":"danger","icon":"fa fa-ban","label":"Attention"},"note":{"className":"info","icon":"fa fa-info-circle","label":"Note"},"style":"callout","tip":{"className":"tip","icon":"fa fa-lightbulb-o","label":"Tip"},"warning":{"className":"warning","icon":"fa fa-exclamation-triangle","label":"Warning"}},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"content/ch02/faq.md","mtime":"2020-03-21T16:37:37.057Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-24T13:21:20.286Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

